<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkRadioAction</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GTK+ 3 参考手册">
<link rel="up" href="Actions.html" title="基于行为的菜单和工具栏">
<link rel="prev" href="gtk3-GtkToggleAction.html" title="GtkToggleAction">
<link rel="next" href="gtk3-GtkRecentAction.html" title="GtkRecentAction">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gtk3-GtkToggleAction.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="Actions.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ 3 参考手册</th>
<td><a accesskey="n" href="gtk3-GtkRecentAction.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gtk3-GtkRadioAction.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gtk3-GtkRadioAction.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gtk3-GtkRadioAction"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gtk3-GtkRadioAction.top_of_page"></a>GtkRadioAction</span></h2>
<p>GtkRadioAction — An action of which only one in a group can be active</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gtk3-GtkRadioAction.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gtk/gtk.h&gt;

struct              <a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction">GtkRadioAction</a>;
<a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="returnvalue">GtkRadioAction</span></a> *    <a class="link" href="gtk3-GtkRadioAction.html#gtk-radio-action-new" title="gtk_radio_action_new ()">gtk_radio_action_new</a>                (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *tooltip</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *stock_id</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> value</code></em>);
<a href="../glib/glib-Singly-Linked-Lists.html#GSList"><span class="returnvalue">GSList</span></a> *            <a class="link" href="gtk3-GtkRadioAction.html#gtk-radio-action-get-group" title="gtk_radio_action_get_group ()">gtk_radio_action_get_group</a>          (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkRadioAction.html#gtk-radio-action-set-group" title="gtk_radio_action_set_group ()">gtk_radio_action_set_group</a>          (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Singly-Linked-Lists.html#GSList"><span class="type">GSList</span></a> *group</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkRadioAction.html#gtk-radio-action-join-group" title="gtk_radio_action_join_group ()">gtk_radio_action_join_group</a>         (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *group_source</code></em>);
<a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gtk3-GtkRadioAction.html#gtk-radio-action-get-current-value" title="gtk_radio_action_get_current_value ()">gtk_radio_action_get_current_value</a>  (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkRadioAction.html#gtk-radio-action-set-current-value" title="gtk_radio_action_set_current_value ()">gtk_radio_action_set_current_value</a>  (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> current_value</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gtk3-GtkRadioAction.description"></a><h2>Description</h2>
<p>
A <a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> is similar to <a class="link" href="gtk3-GtkRadioMenuItem.html#GtkRadioMenuItem" title="struct GtkRadioMenuItem"><span class="type">GtkRadioMenuItem</span></a>. A number of radio
actions can be linked together so that only one may be active at any
one time.
</p>
</div>
<div class="refsect1">
<a name="gtk3-GtkRadioAction.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GtkRadioAction"></a><h3>struct GtkRadioAction</h3>
<pre class="programlisting">struct GtkRadioAction {
  GtkToggleAction parent;
};
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-action-new"></a><h3>gtk_radio_action_new ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="returnvalue">GtkRadioAction</span></a> *    gtk_radio_action_new                (<em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *label</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *tooltip</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *stock_id</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> value</code></em>);</pre>
<p>
Creates a new <a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> object. To add the action to
a <a class="link" href="gtk3-GtkActionGroup.html#GtkActionGroup" title="struct GtkActionGroup"><span class="type">GtkActionGroup</span></a> and set the accelerator for the action,
call <a class="link" href="gtk3-GtkActionGroup.html#gtk-action-group-add-action-with-accel" title="gtk_action_group_add_action_with_accel ()"><code class="function">gtk_action_group_add_action_with_accel()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
<td>A unique name for the action</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>label</code></em> :</span></p></td>
<td>The label displayed in menu items and on buttons,
or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>tooltip</code></em> :</span></p></td>
<td>A tooltip for this action, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>stock_id</code></em> :</span></p></td>
<td>The stock icon to display in widgets representing
this action, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
<td>The value which <a class="link" href="gtk3-GtkRadioAction.html#gtk-radio-action-get-current-value" title="gtk_radio_action_get_current_value ()"><code class="function">gtk_radio_action_get_current_value()</code></a> should
return if this action is selected.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new <a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-action-get-group"></a><h3>gtk_radio_action_get_group ()</h3>
<pre class="programlisting"><a href="../glib/glib-Singly-Linked-Lists.html#GSList"><span class="returnvalue">GSList</span></a> *            gtk_radio_action_get_group          (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>);</pre>
<p>
Returns the list representing the radio group for this object.
Note that the returned list is only valid until the next change
to the group. 
</p>
<p>
A common way to set up a group of radio group is the following:
</p>
<div class="informalexample"><pre class="programlisting">
  GSList *group = NULL;
  GtkRadioAction *action;
 
  while (/* more actions to add */)
    {
       action = gtk_radio_action_new (...);
       
       gtk_radio_action_set_group (action, group);
       group = gtk_radio_action_get_group (action);
    }
</pre></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>the action object</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the list representing the radio group for this object. <span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GtkRadioAction][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-action-set-group"></a><h3>gtk_radio_action_set_group ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_radio_action_set_group          (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Singly-Linked-Lists.html#GSList"><span class="type">GSList</span></a> *group</code></em>);</pre>
<p>
Sets the radio group for the radio action object.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>the action object</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>group</code></em> :</span></p></td>
<td>a list representing a radio group. <span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GtkRadioAction]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-action-join-group"></a><h3>gtk_radio_action_join_group ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_radio_action_join_group         (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *group_source</code></em>);</pre>
<p>
Joins a radio action object to the group of another radio action object.
</p>
<p>
Use this in language bindings instead of the <a class="link" href="gtk3-GtkRadioAction.html#gtk-radio-action-get-group" title="gtk_radio_action_get_group ()"><code class="function">gtk_radio_action_get_group()</code></a> 
and <a class="link" href="gtk3-GtkRadioAction.html#gtk-radio-action-set-group" title="gtk_radio_action_set_group ()"><code class="function">gtk_radio_action_set_group()</code></a> methods
</p>
<p>
A common way to set up a group of radio actions is the following:
</p>
<div class="informalexample"><pre class="programlisting">
  GtkRadioAction *action;
  GtkRadioAction *last_action;
 
  while (/* more actions to add */)
    {
       action = gtk_radio_action_new (...);
       
       gtk_radio_action_join_group (action, last_action);
       last_action = action;
    }
</pre></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>the action object</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>group_source</code></em> :</span></p></td>
<td>a radio action object whos group we are
joining, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to remove the radio action from its group. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 3.0</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-action-get-current-value"></a><h3>gtk_radio_action_get_current_value ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gtk_radio_action_get_current_value  (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>);</pre>
<p>
Obtains the value property of the currently active member of 
the group to which <em class="parameter"><code>action</code></em> belongs.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The value of the currently active group member</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.4</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-radio-action-set-current-value"></a><h3>gtk_radio_action_set_current_value ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_radio_action_set_current_value  (<em class="parameter"><code><a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a> *action</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> current_value</code></em>);</pre>
<p>
Sets the currently active group member to the member with value
property <em class="parameter"><code>current_value</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>action</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkRadioAction.html#GtkRadioAction" title="struct GtkRadioAction"><span class="type">GtkRadioAction</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>current_value</code></em> :</span></p></td>
<td>the new value</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.10</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>